(function(){

    class mySet{  
       constructor(){
          this.item = {}
       }
  
       add(value){
           if(this.item[value]) return false
           this.item[value] = value;
           return true
       }
  
       remove(value){
           if(!this.item[value]) return false;
           let k = this.item[value]
           delete this.item[value]
           return k
       }
  
       has(value){
           if(this.item[value]) return true;
           return false
       }
  
       clear(){
          this.item = {}  
       }
  
       size(){
           return Object.keys(this.item).length
       }
  
       values(){
          return Object.values(this.item)
       }


       // 集合之间的操作
       union(otherSet){
           var unionSet = new mySet()

           let value1 = this.values()
           
           for(let i=0;i<value1.length;i++){
              unionSet.add(value1[i])
           }
           let value2 = otherSet.values()

           for(let j=0;j<value2.length;j++){
            unionSet.add(value2[j])     
           }    
           return unionSet
       }
       
      // 并集
       intersection(otherSet){
           let  newSet = new mySet()

           let values = this.values()
           for(let i=0; i<values.length; i++){
                if(otherSet.has(values[i])) {
                    newSet.add(values[i])
                }
           }
           return newSet
       }

       // 差集
       difference(otherSet){
        let  newSet = new mySet();

        let values = this.values()
           for(let i=0; i<values.length; i++){
                if(!otherSet.has(values[i])) {
                    newSet.add(values[i])
                }
           }
         return newSet
       }
        
       // 判断子集
       subset(otherSet){

          let values = this.values()
          for(let i=0;i<values.length;i++){
               if(!otherSet.has(values[i])){
                  return false
               }
          }

          return true


       }



  
    }

    let k = new mySet();
    k.add("姜浪")
    k.add("姜正")
    k.add("降温")

    let b = new mySet()
    b.add("姜浪")
    b.add("姜正")
    b.add("姜来")

    console.log(k.subset(b)) 


    

})()



